home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
Comm
/
AmiTCP30b2.lha
/
src
/
devs
/
agnet
/
init.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-08
|
2KB
|
93 lines
RCS_ID_C="$Id: init.c,v 3.1 93/10/07 19:24:21 ppessi Exp $";
/*
* init.c --- startup code for agnet.device
*
* Author: ppessi <Pekka.Pessi@hut.fi>
*
* Copyright (c) 1993 OHT-AmiTCP/IP Group,
* Helsinki University of Technology, Finland.
* All rights reserved.
*
* Created : Thu Jan 21 17:32:55 1993 ppessi
* Last modified: Thu Oct 7 18:25:35 1993 ppessi
*
* $Log: init.c,v $
* Revision 3.1 93/10/07 19:24:21 ppessi
* Release 2.1 version
*
* Revision 2.1 93/05/14 16:48:31 ppessi
* Release version
*
*/
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/utility_protos.h>
#include <clib/timer_protos.h>
#include <clib/alib_stdio_protos.h>
#ifdef __SASC
#include <pragmas/exec_pragmas.h>
#endif
#define NOINLINE
#include "agnet.h"
#include "agnet_protos.h"
#include "agnet_rev.h"
/* This is only declaration, it is defined after Start() */
extern const APTR FunctionTable[];
/*
* Starting stub routine
*/
LONG ASM Start(VOID)
{
LONG exit_val;
struct AgnetDevice *ad;
/* Allocate a device base */
if (!(ad = (struct AgnetDevice *)
MakeLibrary(FunctionTable, NULL, NULL, sizeof(*ad), NULL)))
return(20);
ad->ad_SysBase = *(struct ExecBase **)4;
ad->ad_DOSBase = OpenLibrary("dos.library", 36L);
ad->ad_IntuitionBase = OpenLibrary("intuition.library",37L);
/* Open timer device */
if (ad->ad_DOSBase && ad->ad_IntuitionBase &&
!OpenDevice("timer.device", UNIT_MICROHZ,
(struct IORequest *)&ad->ad_Timer, 0L)) {
/* Call main routine */
exit_val = main(ad);
CloseDevice(&ad->ad_Timer);
} else {
exit_val = 40;
}
if (ad->ad_IntuitionBase) CloseLibrary(ad->ad_IntuitionBase);
if (ad->ad_DOSBase) CloseLibrary(ad->ad_DOSBase);
FreeMem((UBYTE *)ad - ad->ad_Device.lib_NegSize,
ad->ad_Device.lib_NegSize + ad->ad_Device.lib_PosSize);
return exit_val;
}
struct AgnetDevice *AgnetDeviceBase = NULL;
/*
* Variables for Device Base
*/
const APTR FunctionTable[] =
{
(APTR) DevOpen,
(APTR) DevClose,
(APTR) DevExpunge,
(APTR) DevReserved,
(APTR) DevBeginIO,
(APTR) DevAbortIO,
(APTR) -1
};